package com.mm.support.domain;

public enum TipoUsuario {
    ADMINISTRADOR(0l, "Administrador"),
    USUARIO(1l, "Usuario"),
    INVITADO(2l, "Invitado");

    private Long code;
    private String name;

    TipoUsuario(Long code, String name) {
        this.code = code;
        this.name = name;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static TipoUsuario findByCode(Long code) {
        TipoUsuario[] array = TipoUsuario.values();
        TipoUsuario status = null;
        for (TipoUsuario anArray : array) {
            if (anArray.getCode().equals(code)) {
                status = anArray;
                break;
            }
        }
        return status;
    }

}
